<?php

namespace app\api\controller\cps;

use app\common\controller\Api;



/**
 * 唯品会接口
 */
class Wph extends Api
{
    protected $noNeedLogin = ['order'];
    protected $noNeedRight = ['*'];

    //商品列表
    public function goods()
    {
        try {
            $page = input('page',1);
            $jxCode = input('jxCode','');
            $jd_model = new \app\api\model\cps\Wph();

            $res = $jd_model->goods($page,$jxCode);
        }  catch (\Exception $e) {
            $this->error($e->getMessage());
        }
        $this->success('请求成功',$res);
    }

    //商品详情
    public function goodsdetail()
    {
        try {
            $id = input('id','');

            $jd_model = new \app\api\model\cps\Wph();

            $res = $jd_model->goodsdetail($id);
        }  catch (\Exception $e) {
            $this->error($e->getMessage());
        }
        $this->success('请求成功',$res);
    }


    //搜索商品列表
    public function searchgoods()
    {
        try {
            $page = input('page',1);
            $keyword = input('keyword','');
            $jd_model = new \app\api\model\cps\Wph();

            $res = $jd_model->searchgoods($page,$keyword);
        }  catch (\Exception $e) {
            $this->error($e->getMessage());
        }
        $this->success('请求成功',$res);
    }


    //商品转链
    public function url()
    {
        try {
            $id = input('id','');
            $jd_model = new \app\api\model\cps\Wph();

            $res = $jd_model->url($id,$this->auth->id);
        }  catch (\Exception $e) {
            $this->error($e->getMessage());
        }
        $this->success('请求成功',$res);
    }

    //订单列表
    public function order()
    {
        try {

            $jd_model = new \app\api\model\cps\Wph();

            $res = $jd_model->order();
        }  catch (\Exception $e) {
            $this->error($e->getMessage());
        }
        $this->success('请求成功',$res);
    }
}